package com.acmetelecom.core;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import com.acmetelecom.customer.Customer;
import com.acmetelecom.utils.Printer;

public class BillGeneratorTest {
	private BillGenerator billGenerator;
	
	@Mock
	private Printer printer;
	
	@Mock
	private Customer customer;

	private List<LineItem> calls;
	
	@Mock
	private LineItem call;

	private BigDecimal callCost = BigDecimal.valueOf(500);

	private String date = "TODAY";

	@Mock
	private Customer callee;

	private String duration = "5 mins";
	
	@Before
	public void before() {
		MockitoAnnotations.initMocks(this);
		billGenerator = new BillGenerator(printer);
		calls = Arrays.asList(call);
		
		when(call.cost()).thenReturn(callCost);
		when(call.date()).thenReturn(date );
		when(call.callee()).thenReturn(callee);
		when(call.durationMinutes()).thenReturn(duration);
	}
	
	@Test
	public void testCorrectBill() {
		billGenerator.send(customer, calls);
		verify(printer).printItem(date , callee , duration , callCost);
	}
}
